package com.sisyphus.mock.data;

import com.sisyphus.mock.data.entities.PostEntity;


import java.util.List;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

@Dao
public interface PostMapper {

    @Insert
    void insertPost(PostEntity post);

    @Query("SELECT * FROM posts WHERE id = :id LIMIT 1")
    PostEntity findById(Long id);

    @Query("SELECT * FROM posts ORDER BY id DESC LIMIT :limit OFFSET (:offset - 1) * :limit")
    List<PostEntity> find(int offset, int limit);

}
